<template>
  <div class="app-container">
      <levelbar></levelbar>
      <div class="content">
        <span class="title">广告类型</span>
        <el-form :model="form" ref="form" label-width="80px" class="form" label-position='right'>
          <el-row :gutter="41" style="padding-bottom: 38px;">
            <el-col :span="10">
              <el-form-item label="广告类型">
                <div v-if="advertId">{{form.value== '4'?'课程学习': form.value == '3'?'周边教育':''}}</div>
                <el-select v-else v-model="form.value" placeholder="请选择" style="width:100%">
                  <el-option v-for="item in form.options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!-- 课程学习 -->
        <courseLearning :advertId='advertId' :advType='form.value' v-if="form.value == '4'"></courseLearning>
        <!-- 周边教育 -->
        <eduPlatform :advertId='advertId' :advType='form.value' v-else-if="form.value == '3'"></eduPlatform>
        
      </div>
  </div>
</template>
<script>
import Levelbar from '../../../layout/Levelbar';
// import advApp from './advApp';
import courseLearning from './courseLearning';
import eduPlatform from './eduPlatform';
export default {
    name: 'EditMangement',
    components: { Levelbar, courseLearning, eduPlatform },
    created() {
      // 传递过来查看那个
        console.log('this.$route.params.state', this.$route.params.state);
        this.getState()
    },
    data() {
        return {
            form: {
                options: [
                    {
                        label: '课程学习',
                        value: '4'
                    },
                    {
                        label: '周边教育',
                        value: '3'
                    }
                ],
                value: '4'
            },
            // getCook: false,
            advertId: this.$route.params.id
        };
    },
    methods: {
        getState() {
            if (this.$route.params.state) {
                // this.getCook = true;
                this.form.value = this.$route.params.state;
            } else {
                this.form.value = '4';
            }
        }
    }
};
</script>
<style lang="scss" scoped>
.top-title{
    text-align: center;
    font-size: 18px;
    color: #333;
    height: 78px;
    line-height: 78px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}
.app-container {
  position: relative;
  padding: 20px 20px 10px;
  .content {
    position: relative;
    padding: 20px 50px 10px;
    background: #fff;
    .title {
      position: relative;
      font-size: 14px;
      color: rgb(106, 85, 72);
      padding-left: 14px;
      margin: 40px 0;
      display: block;
      &::after {
        position: absolute;
        content: "";
        width: 4px;
        height: 14px;
        background: #ff5e2c;
        left: 0;
        top: 4px;
      }
    }
  }
}
</style>
